/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jomijushi.fid.dominio;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author miguel
 */
@Entity
@Table(name = "fid_pedido_compra", catalog = "fid", schema = "")
@NamedQueries({@NamedQuery(name = "FidPedidoCompra.findAll", query = "SELECT f FROM FidPedidoCompra f"), @NamedQuery(name = "FidPedidoCompra.findById", query = "SELECT f FROM FidPedidoCompra f WHERE f.id = :id"), @NamedQuery(name = "FidPedidoCompra.findByFecha", query = "SELECT f FROM FidPedidoCompra f WHERE f.fecha = :fecha"), @NamedQuery(name = "FidPedidoCompra.findBySaldo", query = "SELECT f FROM FidPedidoCompra f WHERE f.saldo = :saldo"), @NamedQuery(name = "FidPedidoCompra.findByTotal", query = "SELECT f FROM FidPedidoCompra f WHERE f.total = :total"), @NamedQuery(name = "FidPedidoCompra.findByTipoCambioMoneda", query = "SELECT f FROM FidPedidoCompra f WHERE f.tipoCambioMoneda = :tipoCambioMoneda"), @NamedQuery(name = "FidPedidoCompra.findByCreatedAt", query = "SELECT f FROM FidPedidoCompra f WHERE f.createdAt = :createdAt"), @NamedQuery(name = "FidPedidoCompra.findByUpdatedAt", query = "SELECT f FROM FidPedidoCompra f WHERE f.updatedAt = :updatedAt")})
public class FidPedidoCompra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Lob
    @Column(name = "descripcion")
    private String descripcion;
    @Column(name = "saldo")
    private Double saldo;
    @Column(name = "total")
    private Double total;
    @Column(name = "tipoCambioMoneda")
    private Double tipoCambioMoneda;
    @Column(name = "created_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;
    @Column(name = "updated_at")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedAt;
    @JoinColumn(name = "fid_proveedor_fid_persona_empresa_id", referencedColumnName = "fid_persona_empresa_id")
    @ManyToOne
    private FidProveedor fidProveedorFidPersonaEmpresaId;
    @JoinColumn(name = "fid_credito_compra_id", referencedColumnName = "id")
    @ManyToOne
    private FidCreditoCompra fidCreditoCompraId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPedidoCompra")
    private List<FidPedidoCompraComprobanteCompra> fidPedidoCompraComprobanteCompraList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPedidoCompraId")
    private List<FidItemCompra> fidItemCompraList;

    public FidPedidoCompra() {
    }

    public FidPedidoCompra(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Double getSaldo() {
        return saldo;
    }

    public void setSaldo(Double saldo) {
        this.saldo = saldo;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }

    public Double getTipoCambioMoneda() {
        return tipoCambioMoneda;
    }

    public void setTipoCambioMoneda(Double tipoCambioMoneda) {
        this.tipoCambioMoneda = tipoCambioMoneda;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public FidProveedor getFidProveedorFidPersonaEmpresaId() {
        return fidProveedorFidPersonaEmpresaId;
    }

    public void setFidProveedorFidPersonaEmpresaId(FidProveedor fidProveedorFidPersonaEmpresaId) {
        this.fidProveedorFidPersonaEmpresaId = fidProveedorFidPersonaEmpresaId;
    }

    public FidCreditoCompra getFidCreditoCompraId() {
        return fidCreditoCompraId;
    }

    public void setFidCreditoCompraId(FidCreditoCompra fidCreditoCompraId) {
        this.fidCreditoCompraId = fidCreditoCompraId;
    }

    public List<FidPedidoCompraComprobanteCompra> getFidPedidoCompraComprobanteCompraList() {
        return fidPedidoCompraComprobanteCompraList;
    }

    public void setFidPedidoCompraComprobanteCompraList(List<FidPedidoCompraComprobanteCompra> fidPedidoCompraComprobanteCompraList) {
        this.fidPedidoCompraComprobanteCompraList = fidPedidoCompraComprobanteCompraList;
    }

    public List<FidItemCompra> getFidItemCompraList() {
        return fidItemCompraList;
    }

    public void setFidItemCompraList(List<FidItemCompra> fidItemCompraList) {
        this.fidItemCompraList = fidItemCompraList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FidPedidoCompra)) {
            return false;
        }
        FidPedidoCompra other = (FidPedidoCompra) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jomijushi.fid.dominio.FidPedidoCompra[id=" + id + "]";
    }

}
